package de.thm.exa.holders;

public class TestResult
{
    private String name;
    private long time, collisions, inserts, rehashes;
    private boolean success;
    private String[] functions;
    private int[] listSizes;
    
    public TestResult(String name, long time, long collisions, long inserts, long rehashes, boolean success, String[] functions, int[] listSizes)
    {
        this.name = name;
        this.time = time;
        this.collisions = collisions;
        this.inserts = inserts;
        this.rehashes = rehashes;
        this.success = success;
        this.functions = functions;
        this.listSizes = listSizes;
    }
    
    @Override
    public String toString()
    {
        StringBuilder result = new StringBuilder( name + ";" + time + ";" + collisions + ";" + inserts + ";" + rehashes + ";");
        for(int i = 0 ; i < functions.length ; i++)
        {
            result.append(functions[i]);
            if( i != functions.length-1 )
            {
                result.append(", ");
            }
        }
        result.append(";");
        for(int i = 0 ; i < listSizes.length ; i++)
        {
            result.append(listSizes[i]);
            if( i != listSizes.length-1 )
            {
                result.append(", ");
            }
        }
        result.append(";").append(success).append(";\n");
        
        return result.toString();
    }
}
